class ScorePanel{
    score:number=0;
    level:number=1;
    maxscoreDiff:number;
    maxLevel:number
    scoreEle:HTMLElement;
    levelEle:HTMLElement;
    constructor(maxscoreDiff:number=20,maxLevel:number=10) {
        this.scoreEle=document.querySelector('#score')!.querySelector('span')!;
        this.levelEle=document.querySelector('#level')!.querySelector('span')!;
        this.maxscoreDiff=maxscoreDiff;
        this.maxLevel=maxLevel;
    }
    addScore(){
        this.scoreEle.innerHTML=++this.score+'';
        if(this.score%this.maxscoreDiff===0) {
            this.levelUp();
        }


    }
    levelUp(){
        if(this.level<=this.maxLevel){
            this.levelEle.innerHTML=++this.level+'';
        }

    }
}

export default ScorePanel;